home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 50.asm < prev    next >
Assembly Source File  |  1999-09-06  |  1KB  |  50 lines

  1. * 50.asm     TLreqcolor    version 0.01   8.6.99
  2.  
  3.  include 'Front.i'
  4.  
  5.  
  6. ; This program demonstrates the use of TLreqcolor to choose a colour/palette
  7.  
  8.  
  9. strings: dc.b 0
  10.  dc.b 'You selected  ',0 ;1
  11.  dc.b 'Error: our of memory',0 ;2
  12.  dc.b 'You selected cancel',0 ;3
  13.  ds.w 0
  14.  
  15.  
  16. * test program
  17. Program:
  18.  TLwindow #-1              ;set things up
  19.  beq Pr_quit               ;quit if can't
  20.  
  21.  TLreqcolor #2             ;2=pen+palette+ld/sv
  22.  subq.w #1,d0              ;d0 -> -1 if bad/cancel, or 0+ for pen chosen
  23.  bmi.s Pr_bad2             ;go if bad/cancel
  24.  
  25.  TLstrbuf #1               ;string 1 to buff
  26.  move.l a4,a0
  27.  add.l #13,a0              ;point to after str 1 in buff
  28.  TLhexasc d0,a0            ;put pen num selected
  29.  clr.b (a0)                ;delimit
  30.  bra.s Pr_rep              ;go report choice
  31.  
  32. Pr_bad1:                   ;here if TLwindow failes
  33.  TLbad #2                  ;report error in monitor
  34.  bra.s Pr_quit
  35.  
  36. Pr_bad2:                   ;here if TLreqcolor bad/cancel
  37.  tst.l xxp_errn(a4)
  38.  bne.s Pr_err              ;go if bad
  39.  TLstrbuf #3               ;str 3 to buff
  40.  bra.s Pr_rep              ;go report cancelled
  41.  
  42. Pr_err:                    ;here if TLreqcolor bad
  43.  TLerror                   ;error report to buff
  44.  
  45. Pr_rep:                    ;report pen chosen / cancelled / error
  46.  TLreqchoose
  47.  
  48. Pr_quit:
  49.  rts
  50.